package com.slimbloody.client;

import com.slimbloody.interfaces.HelloRequest;
import com.slimbloody.interfaces.MyServiceGrpc;
import net.devh.boot.grpc.client.inject.GrpcClient;
import org.springframework.stereotype.Service;

@Service
public class Call2Service {
  @GrpcClient("myService")
  private MyServiceGrpc.MyServiceBlockingStub myServiceStub;

  public String receiveGreeting(String name) {
    HelloRequest request = HelloRequest.newBuilder()
      .setName(name)
      .build();
    return myServiceStub.sayHello(request).getMessage();
  }
}
